#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e6 + 5;

int n, q, k;
int h[N];
int f[N];
bool cmp(int i, int j) { return f[i] < f[j] || (f[i] == f[j] && h[i] >= h[j]); }
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) cin >> h[i];
  cin >> q;
  while (q--) {
    cin >> k;
    f[1] = 0;
    deque<int> dq;
    int pos = 1;
    rep(i, 2, n) {
      int L = max(1, i - k);
      while (pos <= i - 1) {
        while (dq.size() && cmp(pos, dq.back())) dq.pop_back();
        dq.push_back(pos++);
      }
      while (dq.size() && dq.front() < L) dq.pop_front();
      // cout << i << ' ' << dq.front() << endl;
      f[i] = f[dq.front()] + (h[dq.front()] <= h[i] ? 1 : 0);
    }
    cout << f[n] << endl;
  }
  return 0;
}